Method and apparatus for defect-tolerant memory-based artificial neural network

ABSTRACT

Disclosed is a methods and apparatus which can improve defect tolerability of a hardware-based neural network. In one embodiment, a method for performing a calculation of values on first neurons of a first layer in a neural network, includes: receiving a first pattern of a memory cell array; determining a second pattern of the memory cell array according to a third pattern; determining at least one pair of columns of the memory cell array according to the first pattern and the second pattern; switching input data of two columns of each of the at least one pair of columns of the memory cell array; and switching output data of the two columns in each of the at least one pair of columns of the memory cell array so as to determine the values on the first neurons of the first layer.

This application claims the benefit and priority of U.S. ProvisionalApplication No. 62/747,277, filed Oct. 18, 2018, the contents of whichis hereby incorporated by reference in its entirety.

BACKGROUND

Artificial neural networks (ANN) are one of the main tools used inmachine learning, inspired by animal brains. A neural network consistsof input and output layers. In common ANN implementations, the signal ata connection between artificial neurons is a real number, and the outputof each artificial neuron is computed by some non-linear function of thesum of its inputs. The connections between artificial neurons are called“edges”. Artificial neurons and edges typically have a weight thatadjusts as learning proceeds. The weight increases or decreasesindicating an increase or decrease of the strength of the signal at aconnection between two neurons. Artificial neurons may have a thresholdsuch that the signal is only sent if the aggregate signal crosses thatthreshold. Typically, artificial neurons are aggregated into layers.Different layers may perform different kinds of transformations on theirinputs. Signals travel from the first layer (the input layer) to thelast layer (the output layer), possibly after traversing the layersmultiple times.

The networks of neurons are thus connected through edges with differenttransmission efficiencies. Information flowing through the edges ismultiplied by a constant which reflects their efficiency and accuracy.In a hardware-based ANN, the weight of a neuron can be programed on acell of a memory cell array. Defective cells in the memory cell arrayaffect the accuracy of the signals traveling between neurons inrespective layers. Therefore, there exists a need to develop a method toimprove tolerance of artificial neural network to defective cells inmemory cell arrays.

BRIEF DESCRIPTION OF THE DRAWINGS

Aspects of the present disclosure are best understood from the followingdetailed description when read with the accompanying figures. It isnoted that various features are not necessarily drawn to scale. In fact,the dimensions and geometries of the various features may be arbitrarilyincreased or reduced for clarity of illustration.

FIG. 1 illustrates an exemplary diagram of a fully connected network ofan artificial neural network (ANN), in accordance with some embodimentsof present disclosure.

FIG. 2 illustrates an exemplary weight pattern between an input layerand a hidden layer in a network, in accordance with some embodiments ofthe present disclosure.

FIG. 3A illustrates an exemplary defect pattern [D]_(N×M) of a memorycell array, in accordance with some embodiments of the presentdisclosure.

FIG. 3B illustrates an exemplary defect pattern [D]_(N×M) of a memorycell array, in accordance with some embodiments of the presentdisclosure.

FIG. 4A illustrates a plot showing a relationship between a number ofinjected defects in the first and second memory cell arrays and anaccuracy drop-off value, in accordance with some embodiments of thepresent disclosure.

FIG. 4B illustrates a plot showing a relationship between an incorrectcount and a number of errors, in accordance with some embodiments of thepresent disclosure.

FIG. 4C illustrates a plot showing an accuracy drop-off value at eachcolumn of a second memory cell array corresponding to a second weightpattern [X]_(10×64), in accordance with some embodiments of the presentdisclosure.

FIG. 5A illustrates a schematic for rearranging a weight pattern andinput data on a memory cell array, in accordance with some embodiment ofthe present disclosure.

FIG. 5B illustrates a schematic for rearranging a weight pattern andinput data on a memory cell array, in accordance with some embodiment ofthe present disclosure.

FIG. 6A illustrates a block diagram of a system for determining valueson neurons on a hidden layer of a network, in accordance with someembodiments of the present disclosure.

FIG. 6B illustrates a block diagram of a system for determining valueson neurons on a hidden layer of a network, in accordance with someembodiments of the present disclosure.

FIG. 7A illustrates a flow chart of a method for performing acalculation of values on each of the neurons on a hidden layer of anetwork using a neural network macro, in accordance with someembodiments of the present disclosure.

FIG. 7B illustrates a flow chart of a method 730 for swapping I/O's by astate machine in a selector 614, in accordance with some embodiments ofthe present disclosure.

FIG. 7C illustrates a table with exemplary data in a swapping processpresented in FIG. 7B, in accordance with some embodiments of the presentdisclosure.

FIG. 8 illustrates a block diagram of a system for determining values onneurons on a hidden layer of a network, in accordance with someembodiments of the present disclosure.

FIG. 9 illustrates a flow chart of a method for performing a calculationof values on each of the neurons on a hidden layer of a network, inaccordance with some embodiments of the present disclosure.

DETAILED DESCRIPTION OF EXEMPLARY EMBODIMENTS

The following disclosure describes various exemplary embodiments forimplementing different features of the subject matter. Specific examplesof components and arrangements are described below to simplify thepresent disclosure. These are, of course, merely examples and are notintended to be limiting. For example, it will be understood that when anelement is referred to as being “connected to” or “coupled to” anotherelement, it may be directly connected to or coupled to the otherelement, or one or more intervening elements may be present.

There are two fundamentally different alternatives for theimplementation of neural networks: a software simulation in conventionalcomputers or a special hardware solution capable of dramaticallydecreasing execution time. A software simulation can be useful todevelop and debug new algorithms, as well as to benchmark them usingsmall networks. However, if large networks are to be used, a softwaresimulation is not enough. The problem is the time required for thelearning process, which can increase exponentially with the size of thenetwork. Neural networks without learning, however, are ratheruninteresting. But the main objective of building special hardware is toprovide a platform for efficient adaptive systems, capable of updatingtheir parameters in the course of time. New hardware solutions aretherefore necessary. Hardware-based solutions using memory cell arrayscan provide improved power efficiency. Intrinsic differences (e.g., typeand address of defective memory cells in a memory cell array) betweenmemory cells in a memory cell array are typically caused by fabricationprocesses, which leads to intrinsic differences between different memorycell arrays. Individual training processes for different memory cellarrays can significantly increase the cost overhead. This disclosurepresents various embodiments of methods and apparatus which can improvedefect tolerability of a hardware-based neural network.

FIG. 1 illustrates an exemplary diagram of a fully connected network 100of an artificial neural network (ANN), in accordance with someembodiments of present disclosure. The network 100 comprises an inputlayer 112, a hidden layer 114, and an output layer 116. It is noted thatthe network 100 is merely an example, and is not intended to limit thepresent disclosure. Accordingly, it is understood that additional hiddenlayers 114 may be provided in between the input layer 112 and the outputlayer 116 in FIG. 1, and each layers (i.e., 112, 114, and 116) maycomprise different numbers of neurons, which are within the scope ofthis invention. It should be also noted that values on the neurons canbe determined using different algorithms, which are also within thescope of this invention.

In the illustrated embodiments, the input layer 112 comprises aplurality of neurons 106. Each of the plurality of neurons 106 comprisesa respective value, i.e., a₁ on neuron 106-1, a₂ on neuron 106-2, a₃ onneuron 106-3, . . . and am on neuron 106-M, wherein M is a positiveinteger. In some embodiments, the values on neurons 106 on the inputlayer 112 is [A]_(M×1)=[a₁; a₂; a₃; . . . ; a_(M)]. Further, the hiddenlayer 114 comprises a plurality of neurons 108. Each of the plurality ofneurons 108 comprises a respective value, i.e., b₁ on neuron 108-1, b₂on neuron 108-2, b₃ on neuron 108-3, . . . , and b_(N) on neuron 108-N,wherein N is a positive integer. In some embodiments, the values onneurons 108 on the hidden layer 114 is [B]_(N×1)=[b₁; b₂; b₃; . . . ;b_(M)]. Similarly, the output layer 116 comprises a plurality of neurons110, according to some embodiments. Each of the plurality of neurons 110comprises a respective value, i.e., c₁, c₂, c₃, . . . , and c_(P),wherein P is a positive integer. In some embodiments, the values onneurons 110 on the output layer 116 is [C]_(P×1)=[c₁; c₂; c₃; . . . ;c_(P)].

In some embodiments, each of the plurality of neurons 106 in the inputlayer 112 is coupled to each of the plurality of neurons 108 in thehidden layer 114 through a plurality of corresponding weights 102. Forexample, weights w_(1,1), w_(2,1), . . . , and w_(M,1), are used tocouple neurons 106-1, 106-2, 106-3, . . . 106-M of the input layer 112and neuron 108-1 of the hidden layer 114. In some embodiments, each ofthe corresponding weights 102 between the neurons 106 of the input layer112 and the neurons 108 of the hidden layer 114 has a value of either“0” or “1”. In some embodiments, the value of each of the correspondingweights (w_(i,j)) 102 represents a contribution level of the values(a_(i)) of corresponding neurons 106 to the value (i.e., b_(j)) of thecorresponding neurons 108, wherein i≤M, j≤N, i and j are positiveintegers.

Similarly, each of the plurality of neurons 108 in the hidden layer 114is coupled to each of the plurality of neurons 110 in the output layer116 through a plurality of corresponding weights 104. For example,weights, x_(1,1), x_(2,1), . . . , and x_(P,1) are used to couplebetween neurons 108-1, 108-2, 108-3, . . . , and 108-N of the hiddenlayer 114 and neuron 110-1 of the output layer 116. In some embodiments,each of the corresponding weights 104 between the neurons 108 of thehidden layer 114 and the neurons 110 of the output layer 116 has a valueof either “0” or “1”. In some embodiments, the value of each of thecorresponding weights (x_(j,k)) 104 also represents a contribution levelof the values (b_(j)) of the corresponding neurons 108 to the values(c_(k)) of the corresponding neurons 110, wherein j≤N, k≤P, j and k arepositive integers.

In some embodiments, the weights 102 and 104 are trained weightsobtained through a training process according to predefined algorithmsand methods. In some embodiments, a training algorithm is aback-propagation algorithm, in which the weights of the network isrepeatedly adjusted so as to minimize a difference between the actualoutput vector and the described output vector. In some embodiments, theweight training can be performed on-chip using a hardware memory cellarray or off-chip using a software. In some embodiments, the weights ofthe network are determined assuming defect-free memory cell arrays.

In some embodiments, all the values of weights 102 between the inputlayer 112 and the hidden layer 114 are grouped together to form a firstweight pattern 118 [W]_(N×M), which has N rows and M columns. In someembodiments, all the weights 104 between the hidden layer 108 and theoutput layer 110 are grouped together to form a second weight pattern120 [X]_(P×N), which has P rows and N columns. In some embodiments,during implementation, the first weight pattern 118 [W]_(N×M) can beachieved by a first memory cell array and the second weight pattern 120[X]_(P×N) is achieved by a second memory cell array. In someembodiments, the first memory cell array comprises an array of memorycells with a size of N×M and the second memory cell array comprises anarray of memory cells with a size of P×N.

FIG. 2 illustrates an exemplary weight pattern 200 between an inputlayer 112 and a hidden layer 114 in a network 100, in accordance withsome embodiments of the present disclosure. In the illustratedembodiments, a weight pattern sensitivity (WPS) 206 can be obtainedaccording to the corresponding weight pattern 200, e.g., the firstweight pattern 118 [W]_(N×M). In the illustrated embodiments, the WPS200 comprises 1 row and M columns. In some embodiments, the first weightpattern 118 [W]_(N×M) comprises N rows, i.e., 204-1, 204-2, . . . , and204-N, and M columns, i.e., 202-1, 202-2, and 202-M. In someembodiments, the first WPS 200 of the corresponding first weight pattern118 [W]_(N×M) can be determined according to a number of “0” or “1” in acolumn 202. For example, when a number of “1”s in a column 202-j of thefirst weight pattern 118 [W]_(N×M) is equal to or greater than apredefined threshold value, the S_(j) in the WPS 206 is determined as 1,wherein j≤M and is a positive integer. Similarly, when a number of “1”sin a column 202-j of the first weight pattern 118 [W]_(N×M) is less thanthe predefined threshold value, the value of the S_(j) in the WPS 206 isdetermined as “0”. In some embodiments, there is one WPS 200 for acorresponding weight pattern 118 [W]_(N×M).

In some embodiments, values in the WPS 206 is determined by comparingthe number of “1”s in a column of a weight pattern against multi-levelsof thresholds. For example, when the number of “1”s in a column of aweight pattern is equal to or greater than 0 and smaller than 5 and theWPS value for the column is 0; when the number of “1”s in a column of aweight pattern is equal to or greater than 5 and smaller than 10, theWPS value of the column is 1; when the number of “1”s in a column of aweight pattern is equal to or greater than 10 and smaller than 15, theWPS value of the column is 2; and when the number of “1”s in a column ofa weight pattern is equal to or greater than 15 and smaller than thesize of a column (e.g., N), the WPS value of the column is 3.

FIG. 3A illustrates an exemplary defect pattern [D₁]_(N×M) 300 of amemory cell array, in accordance with some embodiments of the presentdisclosure. In the illustrated embodiments, the defect pattern[D₁]_(N×M) 300 is obtained from measuring the memory cell array with asize of N×M for storing the first weight pattern 118 [W]_(N×M) and fordetermining the value on each of the neurons 108 of the hidden layer114. In some embodiments, the memory cell array may comprises one of thefollowing: a plurality of registers, a plurality of e-fuses, a staticrandom access memory (SRAM) and a portion of a memory cell array.

In some embodiments, the defect pattern [D₁]_(N×M) 300 is obtained bywriting “0” or “1” in each of the memory cells in the array followed bymeasuring the logical states saved on each of the memory cells in thearray. When a memory cell which is written with “1” is measured “0”,then the memory cell is determined to be defective and more specifically“set-to-reset” defective; and when a memory cell which is written with“0” is measured “1”, then the memory cell is determined to be alsodefective and more specifically “reset-to-set” defective. In some otherembodiments, when a memory cell which is written with “1” or “0” is alsomeasured as “1” or “0”, the memory cell is determined to be stable andthus non-defective. In some embodiments, when a memory cell is stable,D_(ij)=1; and when a memory cell is defective, D_(ij)=0, wherein i and jare positive integers, i≤M and j≤N.

In some embodiments, a defect pattern indicator (DPI) 306 can beobtained according to a number of defective memory cells in each of Mcolumns 302 of the corresponding defect pattern [D₁]_(N×M) 300. In someembodiments, a DPI 306 comprises 1 row and M columns with respect to thecorresponding defect pattern [D₁]_(N×M) 300, which comprises N rows 304and M columns 302. In some embodiments, when the number of defectivememory cells in a column 302-j of the defect pattern [D₁]_(N×M) 300 isequal to or greater than a predefined threshold value, the correspondingd_(j) in the DPI 306 is determined as “0”; and when the number ofdefective memory cells in a column 302-j of the defect pattern[D₁]_(N×M) 300 is less than the predetermined threshold value, thecorresponding d_(j) in the DPI 306 is determined as “1”.

FIG. 3B illustrates an exemplary defect pattern [D₁]_(N×M) 300 of amemory cell array, in accordance with some embodiments of the presentdisclosure. In the illustrated embodiments, the defect pattern[D₁]_(N×M) 300 is obtained from measuring a memory cell array with asize of N×M for storing the first weight pattern 118 [W]_(N×M) and fordetermining the value on each of the neurons 108 of the hidden layer114. In some embodiments, the memory cell array may comprises one of thefollowing: a plurality of registers, a plurality of e-fuses, a staticrandom access memory (SRAM) and a portion of a memory cell array.

In some embodiments, the defect pattern [D₁]_(N×M) 300 is obtained bywriting “0” or “1” in each of the memory cells in the array followed bymeasuring the logical states saved on each of the memory cells in thearray. When a memory cell which is written with “1” is measured “0”,then the memory cell is determined to be defective and more specifically“set-to-reset” defective; and when a memory cell which is written with“0” is measured “1”, then the memory cell is determined to be alsodefective and more specifically “reset-to-set” defective. In some otherembodiments, when a memory cell which is written with “1” or “0” is alsomeasured as “1” or “0”, the memory cell is determined to be stable andthus non-defective.

In some embodiments, a defect pattern indicator (DPI) 306 can beobtained according to a number of defective memory cells in a column302. In some embodiments, a DPI 306 comprises 1 row and m columns,wherein m=log₂ M, M is the number of columns in the corresponding defectpattern [D₁]_(N×M) 300. In some embodiments, when the number ofdefective memory cells in a column 302-j of the defect pattern[D₁]_(N×M) 300 is equal to or greater than a predefined threshold value,the DPI 306 is determined as the address of the column 302-j. Forexample, when the second column 302-2 and the last column 302-M aredetermined as columns that comprises defective memory cells that aregreater than the predefined threshold value, the DPI-1 306-1 is [00 . .. 1] for the column 302-2 and DPI-2 306-2 is [11 . . . 1] for the column302-M.

FIGS. 4A-C illustrates simulation results using a network 100, inaccordance with some embodiments of the present disclosure. In someembodiments, the network 100 comprises an input layer 112, a hiddenlayer 114, and an output layer 116, wherein the input layer 112comprises N=64 neurons, the hidden layer 114 comprises M=64 neurons andthe output layer 116 comprises P=10 neurons. Further, the network 100comprises 2 weight patterns, i.e., a first weight pattern [W]_(64×64)and a second [X]_(64×10). In some embodiments, the first weight patternis stored in a first memory cell array and the second weight pattern isstored in a second memory cell array. In some embodiments, the firstmemory cell array comprises an array of memory cells with a size of64×64 and the second memory cell array comprises an array of memorycells with a size of 10×64.

FIG. 4A illustrates a plot 400 showing a relationship between a numberof injected defects 404 in the first and second memory cell arrays andan accuracy drop-off value 402, in accordance with some embodiments ofthe present disclosure. In some embodiments, the accuracy drop-off valueis determined by the equation below:Accuracy Dropoff=Accuracy before defect injection−Accuracy after defectinjection

wherein the Accuracy Dropoff 402 in % is a difference in accuracy beforeand after defective cells (hereinafter “defects”) are introduced intothe respective memory cell arrays. In some embodiments, the number ofinjected defects 404 per memory cell array are introduced manually tocreate a first defect pattern [D₁]_(64×64) of the first memory cellarray and a second defect pattern [D₂]_(10×64) of the second memory cellarray. In some embodiments, the defects are injected to thecorresponding memory cell arrays after the corresponding weight patterns(e.g., [W]_(N×M) and [X]_(P×N)) are determined through a trainingprocess, e.g., off-chip using a software with an assumption ofdefect-free memory cell arrays.

In the illustrated embodiments, the accuracy drop-off value 402 equalsto 0.024% when 1 defect is injected to the first memory cell array; theaccuracy drop-off value equals to 0.047%, when 2 defects is injected tothe first memory cell array; the accuracy drop-off value equals to0.070%, when 3 defects is injected to the first memory cell array; theaccuracy drop-off value equals to 0.094%, when 4 defects is injected tothe first memory cell array; and the accuracy drop-off value equals to0.113%, when 5 defects is injected to the first memory cell array.

In the illustrated embodiments, the accuracy drop-off value equals to0.012%, when 1 defect is injected to the second memory cell array; theaccuracy drop-off value equals to 0.024%, when 2 defects is injected tothe second memory cell array; the accuracy drop-off value equals to0.036%, when 3 defects is injected to the second memory cell array; theaccuracy drop-off value equals to 0.047%, when 4 defects is injected tothe second memory cell array; and the accuracy drop-off value equals to0.058%, when 5 defects is injected to the second memory cell array.

In the illustrated embodiments, the accuracy drop-off value equals to0.042%, when 1 defect is injected to each of the first memory cell arrayand the second memory cell arrays; the accuracy drop-off value equals to0.074%, when 2 defects are injected to each of the first memory cellarray and the second memory cell arrays; the accuracy drop-off valueequals to 0.104%, when 3 defects are injected to each of the firstmemory cell array and the second memory cell arrays; the accuracydrop-off value equals to 0.139%, when 4 defects are injected to each ofthe first memory cell array and the second memory cell arrays; and theaccuracy drop-off value equals to 0.167%, when 5 defects are injected toeach of the first memory cell array and the second memory cell arrays.

In the illustrated embodiments, the accuracy drop-off value caused byinjected defects in the first memory cell array is more significant thanthat caused by the same number of injected defects in the second memorycell array. As illustrated in FIG. 4A, injecting defects to the firstmemory cell array can trigger more significant amount of accuracy dropoff than that triggered by injecting defects to the second memory cellarray. It is observed in the simulation results shown in FIG. 4A, thesecond memory cell array has a fewer number of neuron activationreceived from the output of the first memory cell array, e.g., number of“1”s at the output of the first memory cell array, so the number ofdefects in the second memory cell array that is capable of causing thesame accuracy degradation is less. It should be noted that this trend isalso applicable to other numbers of injected defects.

FIG. 4B illustrates a plot 410 showing a relationship between anincorrect count 412 and a number of errors 414, in accordance with someembodiments of the present disclosure. In some embodiments, the numberof errors 414 is a number of test images that are incorrectly classified(e.g., an input image with a digit 8 is recognized and classified as adigit 6 after going through the entire artificial neural network.) Insome embodiments, in order to introduce a 1-to-0 defect, the weight of 1stored in a cell of a memory cell array is modified to 0. Similarly, insome other embodiments, in order to introduce a 0-to-1 defect, theweight of 0 stored in a cell of a memory cell array is modified to 1.

FIG. 4C illustrates a plot 420 showing an accuracy drop-off value 422 ateach column of a second memory cell array corresponding to a secondweight pattern 120 [X]_(10×64), in accordance with some embodiments ofthe present disclosure. Specifically, in this simulation, a curve 426 isa plot of a number of “1”s in each column of the second weight pattern120 [X]_(10×64) versus a row #. In the illustrated embodiments, thenumbers of “1”s in rows #0-#10 of the second weight pattern 120[X]_(10×64) are 16, 17, 13, 13, 12, 15, 16, 17, 13, and 15,respectively. In the illustrated embodiment, the accuracy dropoff valuesin row 1 are 1.13, 2.27, and 3.79 at 1 defect, 2 defects and 3 defects,respectively; the accuracy dropoff values in row 2 are 1, 2.62, and 5.31at 1 defect, 2 defects and 3 defects, respectively; the accuracy dropoffvalues in row 3 are 2.97, 7.90, and 16.94 at 1 defect, 2 defects and 3defects, respectively; the accuracy dropoff values in row 4 are 4.02,8.06, and 12.56 at 1 defect, 2 defects and 3 defects, respectively; theaccuracy dropoff values in row 5 are 3.68, 10.52, and 23.14 at 1 defect,2 defects and 3 defects, respectively; the accuracy dropoff values inrow 6 are 2.83, 7.31, and 14.52 at 1 defect, 2 defects and 3 defects,respectively; the accuracy dropoff values in row 7 are 2.45, 5.06, and9.54 at 1 defect, 2 defects and 3 defects, respectively; the accuracydrop values in row 8 are 1.76, 3.98, and 6.78 at 1 defect, 2 defects and3 defects, respectively; the accuracy dropoff values in row 9 are 3.35,7.42, and 12.77 at 1 defect, 2 defects and 3 defects, respectively; andthe accuracy dropoff values in row 10 are 3.16, 7.94, and 14.52 at 1defect, 2 defects and 3 defects, respectively.

In the illustrated embodiment, when the number of “1”s in a column of aweight pattern is large, the accuracy drop-off value 442 is small; andwhen the number of “1”s in a column of a weight pattern is small, theaccuracy drop-off value 442 is large. As illustrated in this simulationresults, the number of “1”s in a column of a weight pattern iscorrelated to the accuracy drop-off value 442. When the number of “1”sin a column of a weight pattern is larger, the accuracy drop-off valueis smaller and therefore, the column with a larger number of “1”s in aweight pattern is thus tolerant or less sensitive to defects in a columnof memory cells of a memory cell array. Similarly, when the number of“1”s in a column of a weight pattern is smaller, the accuracy drop offis larger, and therefore, the column with a smaller number of “1”s in aweight pattern is sensitive or less tolerant to defects in a column ofmemory cells of a memory cell array.

FIG. 5A illustrates a schematic 500 for rearranging a weight pattern andinput data on a memory cell array, in accordance with some embodiment ofthe present disclosure. In some embodiments, the re-arrangement isdetermined according to the weight pattern sensitivity (WPS) 206 and acorresponding defect pattern 300 of the memory cell array. In theillustrated embodiments, the WPS 206 comprises 1 row and M columns andeach column comprises a binary number indicating the relationshipbetween a number of is in a column of a corresponding weight pattern anda predefined threshold value. For example, if the number of is in acolumn of the corresponding weight pattern is equal to or greater thanthe predefined threshold value, the corresponding element in the WPS 206is equal to 1; and if the number of is in a column of the correspondingweight pattern is less than the predefined threshold value, thecorresponding element in the WPS 206 is equal to 0. In the illustratedembodiments, the last column of WPS 206 is 1 and the first column of theWPS 206 is 0. In illustrated embodiments, the defect pattern 300illustrates a number of defective cells (i.e., defects) in a memory cellarray. In the illustrated embodiments, the first column in the memorycell array is defect-free and the last column of the memory cell arraycontains the greatest number of defects (e.g., 2 defects). According tothe WPS 206 and the detect pattern 300, column 1 of the memory cellarray receives corresponding weights and input data that are originallydesignated for column M of the memory cell array; and column M of thememory cell array receives corresponding weights and inputs data thatare originally designated for column 1 of the memory cell array so as toemploy the column with the least number of defects for the storage ofthe most defect sensitive weight and the corresponding input data.

FIG. 5B illustrates a schematic 510 for a re-arrangement of a weightpattern and input data on a memory cell array, in accordance with someembodiment of the present disclosure. In some embodiments, there-arrangement is determined according to the weight pattern sensitivity(WPS) 206 and a corresponding defect pattern 300. In the illustratedembodiments, the WPS 206 comprises 1 row and M columns and each columncomprises non-binary numbers. In some embodiments, values in the WPS 206is determined by comparing the number of positive weights in a column ofa weight pattern against multi-levels of thresholds. For example, whenthe number of positive weights in a column of a weight pattern is equalto or greater than 0 and smaller than 5 and the WPS value for the columnis 0; when the number of positive weights in a column of a weightpattern is equal to or greater than 5 and smaller than 10, the WPS valueof the column is 1; when the number of positive weights in a column of aweight pattern is equal to or greater than 10 and smaller than 15, theWPS value of the column is 2; and when the number of positive weights ina column of a weight pattern is equal to or greater than 15 and smallerthan the size of a column (e.g., N in FIG. 2), the WPS value of thecolumn is 3.

In illustrated embodiments, the defect pattern 300 illustrates a map ofdefective cells (i.e., defects) in a memory cell array. In theillustrated embodiments, a failure bit count (FBC) 512 of each columnwhich is the number of defects of each column, can be determinedaccording to the given defect pattern 300. In the illustratedembodiment, the first column of the memory cell array comprises 0defect, the second column of the memory cell array comprises 2 defects,the third column of the memory cell array comprises 1 defect, . . . ,the M−2 column of the memory cell array comprises 0 defect, the M−1column of the memory cell array comprises 2 defects, and the M column ofthe memory cell array comprises 1 defect. In the illustrated embodiment,a statistics severity (SS) 514 is determined as a product of the FBC 512and the WPS 206.

According to the SS 514, column 1 of the memory cell array receivescorresponding weights and input data that are originally designated forcolumn M−1 of the memory cell array; and column M−1 of the memory cellarray receives corresponding weights and inputs data that are originallydesignated for column 1 of the memory cell array. Similarly, column 2 ofthe memory cell array receives corresponding weights and input data thatare originally designated for column M−2 of the memory cell array; andcolumn M−2 of the memory cell array receives corresponding weights andinputs data that are originally designated for column 2 of the memorycell array.

In some embodiments, when there is not enough good columns to swap with,we will need to start from one direction (e.g. left to right, lowaddress to high address, low IO number to high IO number, etc).

It should be noted FIGS. 5A-5B are examples and are not intended to belimiting. Different numbers of defects, different values of weightpatterns, different positions and numbers of columns of a memory cellarray that need to be rearranged are within the scope of this invention.

FIG. 6A illustrates a block diagram of a system 600 for determiningvalues on neurons 108 on a hidden layer 114 of a network 100, inaccordance with some embodiments of the present disclosure. It is notedthat the system 600 is merely an example, and is not intended to limitthe present disclosure. Accordingly, it is understood that additionalfunctional blocks may be provided in or coupled to the system 600, andthat some other functional blocks may only be briefly described herein.

In the illustrated embodiment of FIG. 6A, the system 600 comprises aneural network macro 650, wherein the neural network macro 650 comprisesa memory macro 602. In some embodiments, the memory macro 602 comprisesa memory cell array 604, which comprises a plurality of memory cells. Insome embodiments, the plurality of memory cells is arranged in acolumn-row configuration in which each column has a memory line (BL) anda memory line bar (BLB), each row has a word line (WL). Morespecifically, the BL and BLB of each column are respectively coupled toa plurality of memory cells that are disposed in that column, and eachmemory cell in that column is arranged on a different row and coupled toa respective (different) WL. That is, each memory cell of the memorycell array 604 is coupled to a BL of a column of the memory cell array604, a BLB of the column of the memory cell array 604, and a WL of a rowof the memory cell array 604. In some embodiments, the BL's and BLB'sare arranged in parallel vertically and the WL's are arranged inparallel horizontally (i.e., perpendicular to the BL's and BLB's). Insome embodiments, WL for each row of memory cells in the memory cellarray 604 are connected together.

In some embodiments, each of the memory cells of the memory cell array604 comprises at least one transistor. In some other embodiments, eachof the plurality of memory cells of the memory cell array 604 maycomprises one of the following: a memrister, resistive random accessmemory (ReRAM, RRAM), phase change random access memory (PCRAM, PCM),magnetoresistive random access memory (MRAM), conductive bridge randomaccess memory (CBRAM), floating gate flash memory (FLASH), and staticrandom access memory (SRAM).

In some embodiments, the memory macro 602 further comprises a writedriver (WD) 606, a multiplexer (MUX) 608, a sense amplifier (SA) 610 anda control circuit 612. In some embodiments, the WD 606 is configured toprovide a necessary voltage and/or current required to program thememory cell array 604. In some embodiments, the MUX 608 is configured toselect a path to forward input signal to the output. In someembodiments, the SA 610 is configured to compare voltages or currentsgenerated during a read operation with a pre-defined threshold value.

In some embodiments, the control circuit 612 is a representative deviceand may comprise a processor, a memory, an input/output interface, acommunications interface, and a system bus. The processor may compriseany processing circuitry operative to control the operations andperformance of the control circuit 612 of the memory macro 602. Invarious aspects, the processor may be implemented as a general purposeprocessor, a chip multiprocessor (CMP), a dedicated processor, anembedded processor, a digital signal processor (DSP), a networkprocessor, an input/output (I/O) processor, a media access control (MAC)processor, a radio baseband processor, a co-processor, a microprocessorsuch as a complex instruction set computer (CISC) microprocessor, areduced instruction set computing (RISC) microprocessor, and/or a verylong instruction word (VLIW) microprocessor, or other processing device.The processor also may be implemented by a controller, amicrocontroller, an application specific integrated circuit (ASIC), afield programmable gate array (FPGA), a programmable logic device (PLD),and so forth.

In various aspects, the processor may be arranged to run an operatingsystem (OS) and various applications. Examples of an OS comprise, forexample, operating systems generally known under the trade name of AppleOS, Microsoft Windows OS, Android OS, and any other proprietary or opensource OS.

In some embodiments, at least one non-transitory computer-readablestorage medium is provided having computer-executable instructionsembodied thereon, wherein, when executed by at least one processor, thecomputer-executable instructions cause the at least one processor toperform embodiments of the methods described herein. Thiscomputer-readable storage medium can be embodied in the memory.

In some embodiments, the memory may comprise any machine-readable orcomputer-readable media capable of storing data, including bothvolatile/non-volatile memory and removable/non-removable memory. Thememory may comprise at least one non-volatile memory unit. Thenon-volatile memory unit is capable of storing one or more softwareprograms. The software programs may contain, for example, applications,user data, device data, and/or configuration data, or combinationstherefore, to name only a few. The software programs may containinstructions executable by the various components of the control circuit612 of the memory macro 602.

For example, the memory may comprise read-only memory (ROM),random-access memory (RAM), dynamic RAM (DRAM), Double-Data-Rate DRAM(DDR-RAM), synchronous DRAM (SDRAM), static RAM (SRAM), programmable ROM(PROM), erasable programmable ROM (EPROM), electrically erasableprogrammable ROM (EEPROM), flash memory (e.g., NOR or NAND flashmemory), content addressable memory (CAM), polymer memory (e.g.,ferroelectric polymer memory), phase-change memory (e.g., ovonicmemory), ferroelectric memory, silicon-oxide-nitride-oxide-silicon(SONOS) memory, disk memory (e.g., floppy disk, hard drive, opticaldisk, magnetic disk), or card (e.g., magnetic card, optical card), orany other type of media suitable for storing information.

In one embodiment, the memory may contain an instruction set, in theform of a file for executing a method of generating one or more timinglibraries as described herein. The instruction set may be stored in anyacceptable form of machine-readable instructions, including source codeor various appropriate programming languages. Some examples ofprogramming languages that may be used to store the instruction setcomprise, but are not limited to: Java, C, C++, C#, Python, Objective-C,Visual Basic, or .NET programming. In some embodiments a compiler orinterpreter is comprised to convert the instruction set into machineexecutable code for execution by the processor.

In some embodiments, the I/O interface may comprise any suitablemechanism or component to at least enable a user to provide input (i.e.,test/request and or test/normal modes, etc.) to the control circuit 612of the memory macro 602 and the control circuit 612 of the memory macro602 to provide output control to the other components of the memorymacro 602 (e.g., the memory cell array 604, the WD 606, the MUX 608 andthe SA 610.).

In some embodiments, the neural network macro 650 further comprises 2selectors 614/616. In some embodiments, the selector 614 and 616 each isconfigured to swap the input to form a mapped input for the memory cellarray 604 according to a re-arrangement as discussed in FIGS. 5A and 5B.

In some embodiments, the neural network macro 650 further comprises amemory 618. In some embodiments, the memory may comprise anymachine-readable or computer-readable media capable of storing data,including both volatile/non-volatile memory and removable/non-removablememory. The memory may comprise at least one non-volatile memory unit.For example, memory may comprise read-only memory (ROM), random-accessmemory (RAM), dynamic RAM (DRAM), Double-Data-Rate DRAM (DDR-RAM),synchronous DRAM (SDRAM), static RAM (SRAM), programmable ROM (PROM),erasable programmable ROM (EPROM), electrically erasable programmableROM (EEPROM), flash memory (e.g., NOR or NAND flash memory), contentaddressable memory (CAM), polymer memory (e.g., ferroelectric polymermemory), phase-change memory (e.g., ovonic memory), ferroelectricmemory, silicon-oxide-nitride-oxide-silicon (SONOS) memory, disk memory(e.g., floppy disk, hard drive, optical disk, magnetic disk), or card(e.g., magnetic card, optical card), or any other type of media suitablefor storing information.

In one embodiment, the memory 618 contains a defect pattern [D₁]_(N×M)as discussed in FIGS. 3A-3B, in the form of a file or any acceptableform of machine-readable instructions. In some embodiments, the memory618 comprises address of the corresponding defective memory cells in thememory cell array 604. In some embodiments, the defect patternpre-stored in the memory 618 is determined by programming measuring thememory cell array 604 during a manufacturing process.

In some embodiments, the neural network macro 650 further comprises acontroller 620. In some embodiments, the controller 620 is configured toreceive the defect pattern from the memory 618 and a weight patternsensitivity (WPS) 624. In some embodiments, the controller 620 isfurther configured to determine a swapping decision based on the defectpattern 300 and the WPS 206 so as to instruct the selectors 614/616 toperform an I/O swap. In some embodiments, the selectors 614/616 and thecontroller 620 can be configured outside of a system interface 650. Insome embodiments, the outside of the system interface 650 furthercomprises at least one of the following: a processing unit, a sensingunit, and a power regulation unit, all of which are not shown.

FIG. 6B illustrates a block diagram of a system 660 for determiningvalues on neurons 108 on a hidden layer 114 of a network 100, inaccordance with some embodiments of the present disclosure. It is notedthat the system 660 is merely an example, and is not intended to limitthe present disclosure. Accordingly, it is understood that additionalfunctional blocks may be provided in or coupled to the system 660, andthat some other functional blocks may only be briefly described herein.

In the illustrated embodiment of FIG. 6B, the system 660 comprises aneural network macro 650, wherein the neural network 650 comprises amemory macro 602 and a memory 618. In some embodiments, the memory macro602 comprises a memory cell array 604, which comprises a plurality ofmemory cells. In some embodiments, the plurality of memory cells isarranged in a column-row configuration in which each column has a memoryline (BL) and a memory line bar (BLB), each row has a word line (WL).More specifically, the BL and BLB of each column are respectivelycoupled to a plurality of memory cells that are disposed in that column,and each memory cell in that column is arranged on a different row andcoupled to a respective (different) WL. That is, each memory cell of thememory cell array 604 is coupled to a BL of a column of the memory cellarray 604, a BLB of the column of the memory cell array 604, and a WL ofa row of the memory cell array 604. In some embodiments, the BL's andBLB's are arranged in parallel vertically and the WL's are arranged inparallel horizontally (i.e., perpendicular to the BL's and BLB's). Insome embodiments, WL for each row of memory cells in the memory cellarray 604 are connected together.

In some embodiments, each of the memory cells of the memory cell array604 comprises at least one transistor. In some other embodiments, eachof the plurality of memory cells of the memory cell array 604 maycomprises one of the following: a memrister, resistive random accessmemory (ReRAM, RRAM), phase change random access memory (PCRAM, PCM),magnetoresistive random access memory (MRAM), conductive bridge randomaccess memory (CBRAM), floating gate flash memory (FLASH), and staticrandom access memory (SRAM).

In some embodiments, the memory macro 602 further comprises a writedriver (WD) 606, a multiplexer (MUX) 608, a sense amplifier (SA) 610 anda control circuit 612. In some embodiments, the WD 606 is configured toprovide a necessary voltage and/or current required to program thememory cell array 604. In some embodiments, the MUX 608 is configured toselect a path to forward input signal to the output. In someembodiments, the SA 610 is configured to compare voltages or currentsgenerated during a read operation with a pre-defined threshold value.

In some embodiments, the control circuit 612 is a representative deviceand may comprise a processor, a memory, an input/output interface, acommunications interface, and a system bus. The processor may compriseany processing circuitry operative to control the operations andperformance of the control circuit 612 of the memory macro 602. Invarious aspects, the processor may be implemented as a general purposeprocessor, a chip multiprocessor (CMP), a dedicated processor, anembedded processor, a digital signal processor (DSP), a networkprocessor, an input/output (I/O) processor, a media access control (MAC)processor, a radio baseband processor, a co-processor, a microprocessorsuch as a complex instruction set computer (CISC) microprocessor, areduced instruction set computing (RISC) microprocessor, and/or a verylong instruction word (VLIW) microprocessor, or other processing device.The processor also may be implemented by a controller, amicrocontroller, an application specific integrated circuit (ASIC), afield programmable gate array (FPGA), a programmable logic device (PLD),and so forth.

In various aspects, the processor may be arranged to run an operatingsystem (OS) and various applications. Examples of an OS comprise, forexample, operating systems generally known under the trade name of AppleOS, Microsoft Windows OS, Android OS, and any other proprietary or opensource OS.

In some embodiments, at least one non-transitory computer-readablestorage medium is provided having computer-executable instructionsembodied thereon, wherein, when executed by at least one processor, thecomputer-executable instructions cause the at least one processor toperform embodiments of the methods described herein. Thiscomputer-readable storage medium can be embodied in the memory.

In some embodiments, the memory may comprise any machine-readable orcomputer-readable media capable of storing data, including bothvolatile/non-volatile memory and removable/non-removable memory. Thememory may comprise at least one non-volatile memory unit. Thenon-volatile memory unit is capable of storing one or more softwareprograms. The software programs may contain, for example, applications,user data, device data, and/or configuration data, or combinationstherefore, to name only a few. The software programs may containinstructions executable by the various components of the control circuit612 of the memory macro 602.

For example, the memory may comprise read-only memory (ROM),random-access memory (RAM), dynamic RAM (DRAM), Double-Data-Rate DRAM(DDR-RAM), synchronous DRAM (SDRAM), static RAM (SRAM), programmable ROM(PROM), erasable programmable ROM (EPROM), electrically erasableprogrammable ROM (EEPROM), flash memory (e.g., NOR or NAND flashmemory), content addressable memory (CAM), polymer memory (e.g.,ferroelectric polymer memory), phase-change memory (e.g., ovonicmemory), ferroelectric memory, silicon-oxide-nitride-oxide-silicon(SONOS) memory, disk memory (e.g., floppy disk, hard drive, opticaldisk, magnetic disk), or card (e.g., magnetic card, optical card), orany other type of media suitable for storing information.

In one embodiment, the memory may contain an instruction set, in theform of a file for executing a method of generating one or more timinglibraries as described herein. The instruction set may be stored in anyacceptable form of machine-readable instructions, including source codeor various appropriate programming languages. Some examples ofprogramming languages that may be used to store the instruction setcomprise, but are not limited to: Java, C, C++, C#, Python, Objective-C,Visual Basic, or .NET programming. In some embodiments a compiler orinterpreter is comprised to convert the instruction set into machineexecutable code for execution by the processor.

In some embodiments, the memory 618 may comprise any machine-readable orcomputer-readable media capable of storing data, including bothvolatile/non-volatile memory and removable/non-removable memory. Thememory 618 may comprise at least one non-volatile memory unit. Forexample, the memory 618 may comprise read-only memory (ROM),random-access memory (RAM), dynamic RAM (DRAM), Double-Data-Rate DRAM(DDR-RAM), synchronous DRAM (SDRAM), static RAM (SRAM), programmable ROM(PROM), erasable programmable ROM (EPROM), electrically erasableprogrammable ROM (EEPROM), flash memory (e.g., NOR or NAND flashmemory), content addressable memory (CAM), polymer memory (e.g.,ferroelectric polymer memory), phase-change memory (e.g., ovonicmemory), ferroelectric memory, silicon-oxide-nitride-oxide-silicon(SONOS) memory, disk memory (e.g., floppy disk, hard drive, opticaldisk, magnetic disk), or card (e.g., magnetic card, optical card), orany other type of media suitable for storing information.

In one embodiment, the memory 618 contains a defect pattern [D₁]_(N×M)as discussed in FIGS. 3A-3B, in the form of a file or any acceptableform of machine-readable instructions. In some embodiments, the memory618 comprises address of the corresponding defective memory cells in thememory cell array 604. In some embodiments, the defect patternpre-stored in the memory 618 is determined by programming measuring thememory cell array 604 during a manufacturing process.

In some embodiments, the network macro 660 is coupled to a firstselector 614, a second selector 616 and a controller 620. In someembodiments, the system 660 further comprises 2 selectors 614/616. Insome embodiments, the selector 614 and 616 each is configured to swapthe input to form a mapped input for the memory cell array 604 accordingto a re-arrangement as discussed in FIGS. 5A and 5B.

In some embodiments, the controller 620 is configured to receive thedefect pattern from the memory 618 and a weight pattern sensitivity(WPS) 624. In some embodiments, the controller 620 is further configuredto determine a swapping decision based on the defect pattern 300 and theWPS 206 so as to instruct the selectors 614/616 to perform an I/O swap.In some embodiments, the system 660 further comprises at least one ofthe following: a processing unit, a sensing unit, and a power regulationunit, all of which are not shown and are located outside of the neuralnetwork macro 650.

FIG. 7A illustrates a flow chart of a method 700 for performing acalculation of values on each of the neurons 108 on a hidden layer 114of a network 100 using a neural network macro 600 or 660, in accordancewith some embodiments of the present disclosure. In some embodiments,the operations of method 700 are performed by the respective componentsillustrated in FIGS. 1, 3, 5, and 6A-6B. For purposes of discussion, thefollowing embodiment of the method 700 will be described in conjunctionwith FIGS. 1, 3, 5, and 6A-6B. The illustrated embodiment of the method700 is merely an example for performing a weight rearrangement accordingto a weight pattern sensitivity (WPS) of a weight pattern. Therefore, itshould be understood that any of a variety of operations may be omitted,re-sequenced, and/or added while remaining within the scope of thepresent disclosure.

The method 700 starts with operation 702, in which a defect pattern[D₁]_(N×M) 300 of a memory cell array 604 is loaded to a controller 620according to some embodiments. In some embodiments, the defect pattern[D₁]_(N×M) 300 contains addresses of defective memory cells in thememory cell array 604. In some embodiments, a defect pattern indicator(DPI) 306 can be loaded into the controller 620. In some embodiments,the DPI 306 comprises 1 row and m columns, wherein m=log₂ M, M is thenumber of columns in the corresponding defect pattern [D₁]_(N×M) 300. Insome embodiments, when the number of defective memory cells in a column302-j of the defect pattern [D₁]_(N×M) 300 is equal to or greater than apredefined threshold value, the DPI 306 is determined as the address ofthe column 302-j. In some other embodiments, the DPI 306 can alsocomprises N rows and 1 column with respect to the corresponding defectpattern [D₁]_(N×M) 300, which comprises N rows and M columns. In someembodiments, when the number of defective memory cells in a column 302-jof the defect pattern [D₁]_(N×M) 300 is equal to or greater than apredefined threshold value, the value of the dj in the DPI 306 isdetermined as “0”; and when the number of defective memory cells in acolumn 302-j of the defect pattern [D₁]_(N×M) 300 is less than thepredetermined threshold value, the corresponding d_(j) in the DPI 306 isdetermined as “1”. In some embodiments, the defect pattern [D₁]_(N×M)300 or a DPI 306 can be stored in a memory 618.

In some embodiments, prior to the operation 702, the defect pattern[D₁]_(N×M) can be determined by measuring the memory cell array 604. Insome embodiments, the operation 702 further comprises writing apreconfigured logical state (e.g., “1”) to each of a plurality of memorycells in the memory cell array 604 and measure a stored logical state.When the stored logical state in a memory cell is consistent with thepreconfigured logical state, e.g., both are “1”, the memory cell isstable and not defective. When the stored logical state in a memory cellis different from the preconfigured logical state, e.g., the storedlogical state is “0”, the memory cell is determined as defective andthus, the memory cell is a defect in the memory cell array 604.Specifically, the memory cell is “1” to “0” defective. Similarly, when a“0” is written into a memory cell and the stored logical state is “1”,then the memory cell is also determined as “0” to “1” defective. In someembodiments, the operation 702 can be performed by a neural networksystem or a memory manufacture during a fabrication process.

The method 700 continues with operation 704, in which a weight patternsensitivity (WPS) 200 is loaded to the controller 620 according to someembodiments. In the illustrated embodiments, the WPS 200 comprises 1 rowand M columns. In some embodiments, the WPS 200 of the correspondingweight pattern 118 [W]_(N×M) can be determined according to a number of“0” or “1” in a column 202. For example, when a number of “1”s in acolumn 202-j is equal to or greater than a predefined threshold value,the S_(j) in the WPS 200 is determined as 1, wherein j≤N and is apositive integer. Similarly, when a number of “1”s in a column 202-j isless than the predefined threshold value, the S_(j) in the WPS 200 isdetermined as “0”. In some embodiments, there is one WPS 200 for acorresponding weight pattern 118 [W]_(N×M). In some embodiments, the WPS200 can be obtained and/or adjusted by a user externally.

In some embodiments, values in the WPS 200 is determined by comparingthe number of positive weights in a column of a weight pattern againstmulti-levels of thresholds. For example, when the number of positiveweights in a column of a weight pattern is equal to or greater than 0and smaller than 5 and the WPS value for the column is 0; when thenumber of positive weights in a column of a weight pattern is equal toor greater than 5 and smaller than 10, the WPS value of the column is 1;when the number of positive weights in a column of a weight pattern isequal to or greater than 10 and smaller than 15, the WPS value of thecolumn is 2; and when the number of positive weights in a column of aweight pattern is equal to or greater than 15 and smaller than the sizeof a column (e.g., N in FIG. 2), the WPS value of the column is 3.

The method 700 continues with operation 706, in which the WPS 200 andthe defect pattern [D₁]_(N×M) 300 of a corresponding weight pattern 118[W]_(N×M) are compared by the controller 620 according to someembodiments. In some other embodiments, the WPS 200 and the DPI 306 arecompared by the controller 620. In some other embodiments, a product ofthe WPS 200 and a number of defects in each column of the defect pattern[D₁]_(N×M) 300 is determined.

The method 700 continues with operation 708, in which a swappingdecision is determined by the controller 620 according to someembodiments. In some embodiments, a column in the memory cell array 604with a highest number of defects and a highest number of is in acorresponding weight pattern is determined to receive weights and inputdata that are originally stored on a column of the memory cell array 604with a lowest number of defects and a lowest number of 1s in thecorresponding weight pattern. In some other embodiments, a statisticseverity (SS) 514 is determined according to the product of the of theWPS 200 and the number of defects in each column of the defect pattern[D₁]_(N×M) 300. In some embodiments, a column of the memory cell array604 of the memory cell array with a highest number in the SS 514 isdetermined to receive weights and input data that are originally storedon a column of the memory cell array 604 with a lowers number in the SS514.

The method 700 continues with operation 710, in which a weight pattern118 [W]_(N×M) is loaded in to the neural network macro 650 as an input622 according to some embodiments. In some embodiments, the weightpattern 118 [W]_(N×M) is determined through a training process on usinga software without considering the memory cell array 604 and theirpotential defects caused in respective fabrication processes. In someembodiments, the weight pattern 118 [W]_(N×M) is loaded in to the neuralnetwork macro 650 as an input 622 through a selector 614, which islocated out of the neural network macro 650.

The method 700 continues with operation 712 in which the weight pattern118 [W]_(N×M) is rearranged to determine a rearranged weight pattern[W]′_(N×M) by swapping I/O's according to some embodiments. In someembodiments, the rearranged weight pattern [W]′_(N×M) is determinedaccording to the swapping decision determined in the operation 708. Forexample, a column 202-a of the weight pattern 118 [W]_(N×M) at the inputcorresponding to the column in the memory cell array 604 with a highestnumber of defects and a highest number of 1s in the corresponding weightpattern 118 [W]_(N×M) switches with a column 202-b of the weight pattern118 [W]_(N×M) at the input corresponding to the column of the memorycell array 604 with a lowest number of defects and a lowest number of isin the corresponding weight pattern 118 [W]_(N×M), wherein a and b arepositive integer and are both smaller than M. In some embodiments, thisrearrangement process can be described in FIG. 7B below.

FIG. 7B illustrates a flow chart of a method 730 for swapping I/O's by astate machine in a selector 614, in accordance with some embodiments ofthe present disclosure. The method 730 starts with operation 732 inwhich data is provided at input I/O's of the selector 614 according tosome embodiments. In some embodiments, corresponding weight pattern 118[W]_(N×M) is provided at the input I/O's of the selector 614. In someembodiments, the selector 614 is located inside a neural network macro650. In some embodiments, the selector 614 can be selected andimplemented as needed by users. In some embodiments, the data can be oneof the following: the weight pattern 118 [W]_(N×M) and data input [A],which is discussed in detail further below.

The method 730 continues with operation 734 in which data in at leasttwo swapping I/O's is stored according to some embodiments. In someembodiments, the swapping I/O's are input I/O's corresponding to twocolumns in the weight pattern 118 [W]_(N×M), e.g., columns 202-a and202-b. In some embodiments, data in columns 202-a and 202-b are storedin two respective temporary parameters.

The method 730 continues with operation 736 in which two mask arrays areprepared and output I/O's are determined according to some embodiments.In some embodiments, the two mask arrays, including an “OR_mask” and an“AND_mask”, are generated by a selector 614 based on the data content ofthe swapping I/O's at the input 622, e.g., the column 202-a and column202-b of the weight pattern 118 [W]_(N×M). In some embodiments, theoutput_I/O's of the selector 614 are determined by the operation below:

Output I/O's=input I/O's|OR_mask & AND_mask”, wherein “|” is thebit-wise OR operator and “&” is the bit-wise AND operator.

The method 730 continues with operation 738 in which data on the outputI/O's is determined according to some embodiments. In some embodiments,a rearranged weight pattern [W]′_(N×M) is determined according to theweight pattern [W]_(N×M), and the two mask arrays. For example, data inthe column 202-a stored in a first temporary parameter is loaded to theoutput I/O corresponding to the column 202-B and data in the column202-b stored in a second temporary parameter is loaded into the outputI/O corresponding to the column 202-a.

In some embodiments, the method 730 continues with operation 734according to some embodiments.

FIG. 7C illustrates a table 740 with exemplary data in a swappingprocess presented in FIG. 7B, in accordance with some embodiments of thepresent disclosure. In the illustrated embodiments, the input I/O'scomprises 8 bits, which are 01011010, and the third and the fifth aredetermined to be swapped according to the process described in FIG. 7A.In some embodiments, the third I/O comprises data 011 and saved on afirst temporary parameter (e.g., temp 1) and the fifth I/O comprisesdata 101 and stored on a second temporary parameter (i.e., temp 2). Insome embodiments, a first mask (i.e., OR_mask) comprises 8 bits and thethird bit is 1, while all other bits of the second mask are 0; a secondmask (i.e., AND_mask) also comprises 8 bits and the fifth bit is 0,while all the other bits of the second mask are 1. After operation, theoutput I/O's comprises 8 bits, which are 01110010. Further, the thirdI/O in the output I/O outputs data 101 and the fifth I/O in the outputI/O outputs data 011.

The method 700 continues with operation 714 in which the rearrangedweight pattern [W]′_(N×M) is loaded to the memory cell array 604according to some embodiments. In some embodiments, the rearrangedweight pattern [W]′_(N×M) is written by storing a “0” or a “1” incorresponding memory cells of the memory cell array 604. In someembodiments, the column of the memory cell array 604 with a highestnumber of defects and a highest number of 1s in the corresponding weightpattern receives the weights that are originally stored in the column ofthe memory cell array 604 with a lowest number of defects and a lowestnumber of 1s in the corresponding weight pattern. Similarly, the columnof the memory cell array 604 with a lowest number of defects and alowest number of 1s in the corresponding weight pattern receives theweights that are originally stored in the column of the memory cellarray 604 with a highest number of defects and a highest number of 1s inthe corresponding weight pattern. All the other columns receive theircorresponding weights without further modification.

The method 700 continues with operation 716 in which the values on theneurons 106 of the input layer 112 are loaded to the neural networkmacro 600 according to some embodiments. In some embodiments, the valueson the neurons 106 of the input layer 112 are input data [A]_(M×1). Insome embodiments, [A]_(M×1) can be loaded from an output of a previousprocess.

The method 700 continues with operation 712 in which the input data[A]_(M×1) is rearranged to determine a rearranged input data [A]′_(M×1)according to some embodiments. In some embodiments, the rearranged inputdata [A]′_(M×1) is determined according to the swapping decisiondetermined in the operation 708. In some embodiments, the rearrangedinput data [A]′_(M×1) is then transposed from a column to a row([A]′_(1×M)) prior to load to the memory cell array 604. In someembodiments, the rearranged input data [A]′_(M×1) is obtained accordingto the method 730 discussed above in FIG. 7B.

The method 700 continues with operation 714 in which the rearranged andtransposed input data [A]′_(1×M) is loaded into the memory cell array604 according to some embodiments.

The method 700 continues with operation 718 in which a mapped outputdata [B]′_(N×M) is determined according to some embodiments. In someembodiments, the mapped output data [B]′_(N×M) is determined accordingto a predetermined algorithm. In some embodiments, the rearranged inputdata [A]′_(1×M) and the rearranged weight pattern [W]′_(N×M) areprocessed in corresponding memory cells through in-bit multiplication.

The method 700 continues with operation 720 in which an output data[B]_(N×M) is determined according to some embodiments. In someembodiments, the output data [B]_(N×M) is determined through a reversearrangement of the mapped output data [B]′_(N×M) according to theswapping decision. Continue with the example discussed in FIG. 7B,output data on column 202-a of the memory cell array is then output onoutput I/O of the corresponding column 202-b. Similarly, output data oncolumn 202-b of the memory cell array is then output on output I/O ofthe corresponding column 202-b. In some embodiments, the swappingdecision is received from the controller 620 by a selector 616. In someembodiments, the operation 720 is performed by the selector 616 at theoutput.

FIG. 8 illustrates a block diagram of a system 800 for determiningvalues on neurons 108 on a hidden layer 114 of a network 100, inaccordance with some embodiments of the present disclosure. It is notedthat the system 800 is merely an example, and is not intended to limitthe present disclosure. Accordingly, it is understood that additionalfunctional blocks may be provided in or coupled to the system 800, andthat some other functional blocks may only be briefly described herein.

In the illustrated embodiment of FIG. 8, the system 800 comprises aneural network macro 650, wherein the neural network macro 650 comprisesa memory macro 602. In some embodiments, the memory macro 602 comprisesa memory cell array 604, which comprises a plurality of memory cells. Insome embodiments, the plurality of memory cells is arranged in acolumn-row configuration in which each column has a memory line (BL) anda memory line bar (BLB), each row has a word line (WL). Morespecifically, the BL and BLB of each column are respectively coupled toa plurality of memory cells that are disposed in that column, and eachmemory cell in that column is arranged on a different row and coupled toa respective (different) WL. That is, each memory cell of the memorycell array 604 is coupled to a BL of a column of the memory cell array604, a BLB of the column of the memory cell array 604, and a WL of a rowof the memory cell array 604. In some embodiments, the BL's and BLB'sare arranged in parallel vertically and the WL's are arranged inparallel horizontally (i.e., perpendicular to the BL's and BLB's). Insome embodiments, WL for each row of memory cells in the memory cellarray 604 are connected together.

In some embodiments, each of the memory cells of the memory cell array604 comprises at least one transistor. In some other embodiments, eachof the plurality of memory cells of the memory cell array 604 maycomprises one of the following: a memrister, resistive random accessmemory (ReRAM, RRAM), phase change random access memory (PCRAM, PCM),magnetoresistive random access memory (MRAM), conductive bridge randomaccess memory (CBRAM), floating gate flash memory (FLASH), and staticrandom access memory (SRAM).

In some embodiments, the memory macro 602 further comprises a writedriver (WD) 606, a multiplexer (MUX) 608, a sense amplifier (SA) 610 anda control circuit 612. In some embodiments, the WD 606 is configured toprovide a necessary voltage and/or current required to program thememory cell array 604. In some embodiments, the MUX 608 is configured toselect a path to forward input signal to the output. In someembodiments, the SA 610 is configured to compare voltages or currentsgenerated during a read operation with a pre-defined threshold value.

In some embodiments, the control circuit 612 is a representative deviceand may comprise a processor, a memory, an input/output interface, acommunications interface, and a system bus. The processor may compriseany processing circuitry operative to control the operations andperformance of the control circuit 612 of the memory macro 602. Invarious aspects, the processor may be implemented as a general purposeprocessor, a chip multiprocessor (CMP), a dedicated processor, anembedded processor, a digital signal processor (DSP), a networkprocessor, an input/output (I/O) processor, a media access control (MAC)processor, a radio baseband processor, a co-processor, a microprocessorsuch as a complex instruction set computer (CISC) microprocessor, areduced instruction set computing (RISC) microprocessor, and/or a verylong instruction word (VLIW) microprocessor, or other processing device.The processor also may be implemented by a controller, amicrocontroller, an application specific integrated circuit (ASIC), afield programmable gate array (FPGA), a programmable logic device (PLD),and so forth.

In various aspects, the processor may be arranged to run an operatingsystem (OS) and various applications. Examples of an OS comprise, forexample, operating systems generally known under the trade name of AppleOS, Microsoft Windows OS, Android OS, and any other proprietary or opensource OS.

In some embodiments, at least one non-transitory computer-readablestorage medium is provided having computer-executable instructionsembodied thereon, wherein, when executed by at least one processor, thecomputer-executable instructions cause the at least one processor toperform embodiments of the methods described herein. Thiscomputer-readable storage medium can be embodied in the memory.

In some embodiments, the memory may comprise any machine-readable orcomputer-readable media capable of storing data, including bothvolatile/non-volatile memory and removable/non-removable memory. Thememory may comprise at least one non-volatile memory unit. Thenon-volatile memory unit is capable of storing one or more softwareprograms. The software programs may contain, for example, applications,user data, device data, and/or configuration data, or combinationstherefore, to name only a few. The software programs may containinstructions executable by the various components of the control circuit612 of the memory macro 602.

For example, the memory may comprise read-only memory (ROM),random-access memory (RAM), dynamic RAM (DRAM), Double-Data-Rate DRAM(DDR-RAM), synchronous DRAM (SDRAM), static RAM (SRAM), programmable ROM(PROM), erasable programmable ROM (EPROM), electrically erasableprogrammable ROM (EEPROM), flash memory (e.g., NOR or NAND flashmemory), content addressable memory (CAM), polymer memory (e.g.,ferroelectric polymer memory), phase-change memory (e.g., ovonicmemory), ferroelectric memory, silicon-oxide-nitride-oxide-silicon(SONOS) memory, disk memory (e.g., floppy disk, hard drive, opticaldisk, magnetic disk), or card (e.g., magnetic card, optical card), orany other type of media suitable for storing information.

In one embodiment, the memory may contain an instruction set, in theform of a file for executing a method of generating one or more timinglibraries as described herein. The instruction set may be stored in anyacceptable form of machine-readable instructions, including source codeor various appropriate programming languages. Some examples ofprogramming languages that may be used to store the instruction setcomprise, but are not limited to: Java, C, C++, C#, Python, Objective-C,Visual Basic, or .NET programming. In some embodiments a compiler orinterpreter is comprised to convert the instruction set into machineexecutable code for execution by the processor.

In some embodiments, the I/O interface may comprise any suitablemechanism or component to at least enable a user to provide input (i.e.,test/request and or test/normal modes, etc.) to the control circuit 612of the memory macro 602 and the control circuit 612 of the memory macro602 to provide output control to the other components of the memorymacro 602 (e.g., the memory cell array 604, the WD 606, the MUX 608 andthe SA 610.).

In some embodiments, the neural network macro 650 further comprises 2selectors 614/616. In some embodiments, the selector 614 is configuredto swap the input to form a mapped input for the memory cell array 604according to a swapping decision as discussed in FIGS. 5A and 5B and theselector 616 is configured to swap the output of the memory cell array604 according to the swapping decision as discussed in FIGS. 5A and 5B.

In some embodiments, the neural network macro 650 further comprises amemory 618. In some embodiments, the memory may comprise anymachine-readable or computer-readable media capable of storing data,including both volatile/non-volatile memory and removable/non-removablememory. The memory may comprise at least one non-volatile memory unit.For example, memory may comprise read-only memory (ROM), random-accessmemory (RAM), dynamic RAM (DRAM), Double-Data-Rate DRAM (DDR-RAM),synchronous DRAM (SDRAM), static RAM (SRAM), programmable ROM (PROM),erasable programmable ROM (EPROM), electrically erasable programmableROM (EEPROM), flash memory (e.g., NOR or NAND flash memory), contentaddressable memory (CAM), polymer memory (e.g., ferroelectric polymermemory), phase-change memory (e.g., ovonic memory), ferroelectricmemory, silicon-oxide-nitride-oxide-silicon (SONOS) memory, disk memory(e.g., floppy disk, hard drive, optical disk, magnetic disk), or card(e.g., magnetic card, optical card), or any other type of media suitablefor storing information.

In one embodiment, the memory 618 contains a defect pattern [D₁]_(N×M)as discussed in FIGS. 3A-3B, in the form of a file or any acceptableform of machine-readable instructions. In some embodiments, the memory618 comprises address of the corresponding defective memory cells in thememory cell array 604. In some embodiments, the defect patternpre-stored in the memory 618 is determined by measuring the memory cellarray 604 during a manufacturing process.

In some embodiments, the neural network macro 650 further comprises acontroller 620. In some embodiments, the controller 620 is configured toreceive the defect pattern from the memory 618 and a weight patternsensitivity (WPS) 624. In some embodiments, the controller 620 isfurther configured to determine a swapping decision based on the defectpattern 300 and the WPS 624 so as to instruct the selectors 614/616 toperform an I/O swap.

In some embodiments, the neural network macro 650 further comprises abuffer 802 and a processor 804. In some embodiments, the buffer 802stores a plurality of weights which are used by the processor 804 todetermine the WPS 624. In some embodiments, the processor 804 is enabledby an EN signal 806 to determine the WPS 624 according to the pluralityof weights stored in the buffer 802. In some embodiments, the outside ofthe system interface 650 further comprises at least one of thefollowing: a processing unit, a sensing unit, and a power regulationunit, all of which are not shown.

FIG. 9 illustrates a flow chart of a method 900 for performing acalculation of values on each of the neurons 108 on a hidden layer 114of a network 100, in accordance with some embodiments of the presentdisclosure. In some embodiments, the operations of method 900 areperformed by the respective components illustrated in FIGS. 1-4, 5, 7B,and 8. For purposes of discussion, the following embodiment of themethod 900 will be described in conjunction with FIGS. 1-4, 5, 7B, and8. The illustrated embodiment of the method 900 is merely an example forperforming a calculation of values on each of the neurons 108 on ahidden layer 114 of a network 100. Therefore, it should be understoodthat any of a variety of operations may be omitted, re-sequenced, and/oradded while remaining within the scope of the present disclosure. Itshould be also noted the network 100 may comprises a plurality of hiddenlayers and each of the plurality of hidden layers may comprisesdifferent numbers of neurons, the I/O's that are determined to beswapped may be more than 2, and values on each of the neurons can bedetermined using different algorithms, which are all within the scope ofthis invention.

The method 900 starts with operation 902, in which a defect pattern[D₁]_(N×M) 300 of a memory cell array 604 is loaded into a memory 618 ofa neural network macro 650 according to some embodiments. In someembodiments, the defect pattern [D₁]_(N×M) 300 contains addresses ofdefective memory cells in the memory cell array 604. In someembodiments, a defect pattern indicator (DPI) 306 can be loaded into thecontroller 620. In some embodiments, the DPI 306 comprises row and mcolumns, wherein m=log₂ M, M is the number of columns in thecorresponding defect pattern [D₁]_(N×M) 300. In some embodiments, whenthe number of defective memory cells in a column 302-j of the defectpattern [D₁]_(N×M) 300 is equal to or greater than a predefinedthreshold value, the DPI 306 is determined as the address of the column302-j. In some other embodiments, the DPI 306 can also comprises N rowsand 1 column with respect to the corresponding defect pattern [D₁]_(N×M)300, which comprises N rows and M columns. In some embodiments, when thenumber of defective memory cells in a column 302-j of the defect pattern[D₁]_(N×M) 300 is equal to or greater than a predefined threshold value,the value of the dj in the DPI 306 is determined as “0”; and when thenumber of defective memory cells in a column 302-j of the defect pattern[D₁]_(N×M) 300 is less than the predetermined threshold value, thecorresponding dj in the DPI 306 is determined as “1”. In someembodiments, the defect pattern [D₁]_(N×M) 300 or a DPI 306 can bestored in a memory 618.

In some embodiments, the defect pattern [D₁]_(N×M) 300 can be determinedby measuring the memory cell array 604. In some embodiments, theoperation 902 further comprises writing a preconfigured logical state(e.g., “1”) to each of a plurality of memory cells in the memory cellarray 604 and measure a stored logical state. When the stored logicalstate in a memory cell is consistent with the preconfigured logicalstate, e.g., both are “1”, the memory cell is stable and not defective.When the stored logical state in a memory cell is different from thepreconfigured logical state, e.g., the stored logical state is “0”, thememory cell is determined as defective and the memory cell is a defectin the memory cell array 604. In some embodiments, the operation 902 canbe performed by a neural network system or a memory manufacture during afabrication process.

The method 900 continues with operation 904, in which a weight pattern118 [W]_(N×M) is loaded in to the neural network macro 650 as an input622 according to some embodiments. In some embodiments, the weightpattern 118 [W]_(N×M) is determined through a training process using asoftware without considering the memory cell array 604 and theirpotential defects introduced in respective fabrication processes. Insome embodiments, the weight pattern 118 [W]_(N×M) is loaded into theneural network macro 650 as the input 622 to a buffer 802 of the neuralnetwork macro 650.

The method 900 continues with operation 906, in which a weight patternsensitivity (WPS) 200 is determined according to some embodiments. Insome embodiments, the WPS 200 is determined by a processor 804 of theneural network macro 650 according to the weights of the weight pattern118 [W]_(N×M) stored in the buffer 802. In the illustrated embodiments,the WPS 200 comprises 1 row and M columns. In some embodiments, the WPS200 of the corresponding weight pattern 118 [W]_(N×M) can be determinedaccording to a number of “0” or “1” in a column 202. For example, when anumber of “1”s in a column 202-j is equal to or greater than apredefined threshold value, the S_(j) in the WPS 200 is determined as 1,wherein j≤N and is a positive integer. Similarly, when a number of “1”sin a column 202-j is less than the predefined threshold value, the S_(j)in the WPS 200 is determined as “0”. In some embodiments, there is oneWPS 200 for a corresponding weight pattern 118 [W]_(N×M). In someembodiments, the WPS 200 can be different according to differentthreshold values, which can be predefined or specified by the user.Comprise a number of integer values corresponding to the multi-levels ofthreshold values.

In some embodiments, values in the WPS 200 is determined by comparingthe number of positive weights in a column of a weight pattern againstmulti-levels of thresholds. For example, when the number of positiveweights in a column of a weight pattern is equal to or greater than 0and smaller than 5 and the WPS value for the column is 0; when thenumber of positive weights in a column of a weight pattern is equal toor greater than 5 and smaller than 10, the WPS value of the column is 1;when the number of positive weights in a column of a weight pattern isequal to or greater than 10 and smaller than 15, the WPS value of thecolumn is 2; and when the number of positive weights in a column of aweight pattern is equal to or greater than 15 and smaller than the sizeof a column (e.g., N in FIG. 2), the WPS value of the column is 3.

The method 900 continues with operation 908, in which the WPS 200 andthe defect pattern [D₁]_(N×M) 300 of a corresponding weight pattern 118[W]_(N×M) are compared by the controller 620 according to someembodiments. In some other embodiments, the WPS 200 and the DPI 306 arecompared by the controller 620. In some other embodiments, a product ofthe WPS 200 and a number of defects in each column of the defect pattern[D₁]_(N×M) 300 is determined. In some embodiments, the controller 620receives the WPS 624 from the processor 804 and the defect pattern 300from the memory 618 so as to determine a swapping decision.

The method 900 continues with operation 910, in which a swappingdecision is determined by the controller 620 according to someembodiments. In some embodiments, a column in the memory cell array 604with a highest number of defects and a highest number of is in acorresponding weight pattern is determined to receive weights and inputdata that are originally stored on a column of the memory cell array 604with a lowest number of defects and a lowest number of 1s in thecorresponding weight pattern. In some other embodiments, a statisticseverity (SS) 514 is determined according to the product of the of theWPS 200 and the number of defects in each column of the defect pattern[D₁]_(N×M) 300. In some embodiments, a column of the memory cell array604 of the memory cell array with a highest number in the SS 514 isdetermined to receive weights and input data that are originally storedon a column of the memory cell array 604 with a lowers number in the SS514.

The method 900 continues with operation 912 in which the weight pattern118 [W]_(N×M) is loaded to a selector 614 according to some embodiments.In some embodiments, the weight pattern 118 [W]_(N×M) is loaded to theselector 614 from the buffer 802.

The method 900 continues with operation 914 in which the weight pattern118 [W]_(N×M) rearranged to determine a mapped weight pattern [W]′_(N×M)according to some embodiments. In some embodiments, the mapped weightpattern [W]′_(N×M) is determined according to the swapping decisiondetermined in the operation 910. For example, a column 202-a of theweight pattern 118 [W]_(N×M) at the input corresponding to the column inthe memory cell array 604 with a highest number of defects and a highestnumber of is in the corresponding weight pattern 118 [W]_(N×M) switcheswith a column 202-b of the weight pattern 118 [W]_(N×M) at the inputcorresponding to the column of the memory cell array 604 with a lowestnumber of defects and a lowest number of 1s in the corresponding weightpattern 118 [W]_(N×M), wherein a and b are positive integer and are bothsmaller than M.

The method 900 continues with operation 916 in which the mapped weightpattern [W]′_(N×M) is loaded to the memory cell array 604 according tosome embodiments. In some embodiments, the mapped weight pattern[W]′_(N×M) is written by storing a “0” or a “1” in corresponding memorycells of the memory cell array 604. In some embodiments, the column ofthe memory cell array 604 with a highest number of defects and a highestnumber of 1s in the corresponding weight pattern receives the weightsthat are originally stored in the column of the memory cell array 604with a lowest number of defects and a lowest number of 1s in thecorresponding weight pattern. Similarly, the column of the memory cellarray 604 with a lowest number of defects and a lowest number of 1s inthe corresponding weight pattern receives the weights that areoriginally stored in the column of the memory cell array 604 with ahighest number of defects and a highest number of 1s in thecorresponding weight pattern. All the other columns receive theircorresponding weights without further modification.

The method 900 continues with operation 912 in which the values on theneurons 106 of the input layer 112 are loaded to the neural networkmacro 650 according to some embodiments. In some embodiments, the valueson the neurons 106 of the input layer 112 are input data [A]_(M×1). Insome embodiments, [A]_(M×1) can be loaded from an output of a previousnetwork.

The method 900 continues with operation 914 in which the input data[A]_(M×1) is rearranged to determine a mapped input data [A]′_(M×1)according to some embodiments. In some embodiments, the mapped inputdata [A]′_(M×1) is determined according to the swapping decisiondetermined in the operation 910. In some embodiments, the mapped inputdata [A]′_(M×1) is then transposed from a column to a row ([A]′_(1×M))prior to load to the memory cell array 604. In some embodiments, themapped input data [A]′_(M×1) is obtained according to the method 730shown in FIG. 7B.

The method 900 continues with operation 916 in which the mapped andtransposed input data [A]′_(1×M) is loaded into the memory cell array604 according to some embodiments.

The method 900 continues with operation 918 in which a mapped outputdata [B]′_(N×M) is determined according to some embodiments. In someembodiments, the mapped output data [B]′_(N×M) is determined accordingto a predetermined algorithm. In some embodiments, the mapped andtransposed input data [A]′_(1×M) and the mapped weight pattern[W]′_(N×M) are processed in corresponding memory cells through in-bitmultiplication.

The method 900 continues with operation 920 in which an output data[B]_(N×M) is determined according to some embodiments. In someembodiments, the output data [B]_(N×M) is determined through a reversearrangement of the mapped output data [B]′_(N×M) according to theswapping decision. Continue with the example discussed in FIG. 7B,output data on column 202-a of the memory cell array is then output onoutput I/O of the corresponding column 202-b and output data on column202-b of the memory cell array is then output on output I/O of thecorresponding column 202-b. In some embodiments, the swapping decisionis received by a selector 616 from the controller 620. In someembodiments, the operation 920 is performed by the selector 616 at theoutput of the neural network macro 650 of FIG. 8.

In one embodiment, a method for performing a calculation of values onfirst neurons of a first layer in a neural network, includes: receivinga first pattern of a memory cell array, wherein the memory cell arraycomprises a plurality of memory cells configured in a plurality ofcolumns and a plurality of rows; determining a second pattern of thememory cell array using a third pattern; determining at least one pairof columns of the memory cell array according to the first pattern andthe second pattern; switching input data of two columns of each of theat least one pair of columns of the memory cell array; performing abit-wise calculation using the input data stored in the plurality ofmemory cells; and switching output data of the two columns in each ofthe at least one pair of columns of the memory cell array so as todetermine the values on the first neurons of the first layer.

In another embodiment, a system for performing a calculation of valueson first neurons of a first layer in a neural network, includes: amemory cell array comprising a plurality of memory cells configured in aplurality of columns and a plurality of rows; a memory unit configuredto store a first pattern; a processor unit configured to determine asecond pattern using a third pattern; a controller unit configured todetermine at least one pair of columns of the memory cell arrayaccording to the first a pattern received from the memory unit and thesecond pattern received from the processor unit; a first selectorconfigured to switch input data of two columns in each of the at leastone pair of columns of the memory cell array; and a second selectorconfigured to switch output data of the two columns in each of the atleast one pair of columns of the memory cell array so as to determinethe values on the respective neurons.

Yet, in another embodiment, a system for performing a calculation ofvalues on first neurons of a first layer in a neural network, includes:a memory cell array comprising a plurality of memory cells configured ina plurality of columns and a plurality of rows; a memory unit configuredto store a first pattern; a processor unit configured to determine asecond pattern using a third pattern; a controller unit configured todetermine at least one pair of columns of the memory cell arrayaccording to the first a pattern received from the memory unit and thesecond pattern received from the processor unit; a first selectorconfigured to switch input data of two columns in each of the at leastone pair of columns of the memory cell array; and a second selectorconfigured to switch output data of the two columns in each of the atleast one pair of columns of the memory cell array so as to determinethe values on the respective neurons, wherein the first pattern is adefect pattern, wherein the defect pattern maps at least one defectivememory cell in the memory cell array, wherein the second patterncomprises a plurality of weight pattern sensitivity values, wherein eachof the plurality of weight pattern sensitivity values is determined bycomparing at least one predetermined threshold value with one of thefollowing in a corresponding column in the third pattern: a number oflogical “1” values and a second number of logical “0” values, andwherein the third pattern is a weight pattern comprising a plurality ofweights, wherein each of the plurality of weights has a value of “0” or“1”.

The foregoing outlines features of several embodiments so that thoseordinary skilled in the art may better understand the aspects of thepresent disclosure. Those skilled in the art should appreciate that theymay readily use the present disclosure as a basis for designing ormodifying other processes and structures for carrying out the samepurposes and/or achieving the same advantages of the embodimentsintroduced herein. Those skilled in the art should also realize thatsuch equivalent constructions do not depart from the spirit and scope ofthe present disclosure, and that they may make various changes,substitutions, and alterations herein without departing from the spiritand scope of the present disclosure.

What is claimed is:
 1. A method for performing a calculation of valueson first neurons of a first layer in a neural network, comprising:receiving a first pattern of a memory cell array, wherein the memorycell array comprises a plurality of memory cells configured in aplurality of columns and a plurality of rows; determining a secondpattern of the memory cell array using a third pattern; determining atleast one pair of columns of the memory cell array according to thefirst pattern and the second pattern; switching input data of twocolumns of each of the at least one pair of columns of the memory cellarray; performing a bit-wise calculation using the input data stored inthe plurality of memory cells; and switching output data of the twocolumns in each of the at least one pair of columns of the memory cellarray so as to determine the values on the first neurons of the firstlayer.
 2. The method of claim 1, wherein the first pattern is a defectpattern, wherein the defect pattern maps at least one defective memorycell in the memory cell array.
 3. The method of claim 1, furthercomprising: prior to receiving the first pattern, writing apreconfigured logical state to each of the plurality of memory cells;measuring a stored logical state in each of the plurality of memorycells; and comparing the preconfigured logical state and the storedlogical state in each of the plurality of memory cells so as todetermine at least one defective memory cell.
 4. The method of claim 1,wherein the second pattern comprises a plurality of weight patternsensitivity values, wherein each of the plurality of weight patternsensitivity values is determined by comparing at least one predeterminedthreshold value with one of the following in a corresponding column inthe third pattern: a first number of logic “1” values and a secondnumber of logic “0” values.
 5. The method of claim 1, wherein the thirdpattern is a weight pattern comprising a plurality of weights, whereineach of the plurality of weights has a value of “0” or “1”.
 6. Themethod of claim 1, wherein the third pattern is determined through anoff-chip training process.
 7. The method of claim 1, wherein thedetermining at least one pair of columns further comprises: determininga number of defective memory cells in each of the plurality of columnsof the memory cell array according to the first pattern; determining astatistic severity value of each of the plurality of columns, whereinthe statistic severity value of a corresponding column is determined asa product of the number of defective memory cells and a value of thecorresponding column in the second pattern; and determining the at leastone pair of columns according to the statistic severity value.
 8. Themethod of claim 1, wherein the input data comprises one of thefollowing: the third pattern and output data of second neurons of asecond layer, wherein the second neurons of the second layer are coupledto the first neurons of the first layer.
 9. A system for performing acalculation of values on first neurons of a first layer in a neuralnetwork, comprising: a memory cell array comprising a plurality ofmemory cells configured in a plurality of columns and a plurality ofrows; a memory unit configured to store a first pattern; a processorunit configured to determine a second pattern using a third pattern; acontroller unit configured to determine at least one pair of columns ofthe memory cell array according to the first a pattern received from thememory unit and the second pattern received from the processor unit; afirst selector configured to switch input data of two columns in each ofthe at least one pair of columns of the memory cell array; and a secondselector configured to switch output data of the two columns in each ofthe at least one pair of columns of the memory cell array so as todetermine the values on the respective neurons.
 10. The system of claim9, wherein the first pattern is a defect pattern, wherein the defectpattern maps at least one defective memory cell in the memory cellarray.
 11. The system of claim 9, wherein the first pattern isdetermined by: writing a preconfigured logical state to each of theplurality of memory cells; measuring a stored logical state in each ofthe plurality of memory cells; and comparing the preconfigured logicalstate and the stored logical state in each of the plurality of memorycells.
 12. The system of claim 9, wherein the second pattern comprises aplurality of weight pattern sensitivity values, wherein each of theplurality of weight pattern sensitivity values is determined bycomparing at least one predetermined threshold value with one of thefollowing in a corresponding column in the third pattern: a number oflogical “1” values and a second number of logical “0” values.
 13. Thesystem of claim 9, wherein the third pattern is a weight patterncomprising a plurality of weights, wherein each of the plurality ofweights has a value of “0” or “1”.
 14. The system of claim 9, whereinthe input data comprises one of the following: the third pattern andoutput data of second neurons of a second layer, wherein the secondneurons of the second layer are coupled to the first neurons of thefirst layer.
 15. The system of claim 9, wherein the first selector andthe second selector are controlled by the controller.
 16. The system ofclaim 9, wherein the third pattern is determined through an off-chiptraining process.
 17. The system of claim 9, wherein the at least onepair of columns is determined according to statistic severity values ofthe plurality of columns, wherein each of the statistic severity valuesof a corresponding column is determined as a product of a number ofdefective memory cells of the corresponding column and a value of thecorresponding column in the second pattern.
 18. A system for performinga calculation of values on first neurons of a first layer in a neuralnetwork, comprising: a memory cell array comprising a plurality ofmemory cells configured in a plurality of columns and a plurality ofrows; a memory unit configured to store a first pattern; a processorunit configured to determine a second pattern using a third pattern; acontroller unit configured to determine at least one pair of columns ofthe memory cell array according to the first a pattern received from thememory unit and the second pattern received from the processor unit; afirst selector configured to switch input data of two columns in each ofthe at least one pair of columns of the memory cell array; and a secondselector configured to switch output data of the two columns in each ofthe at least one pair of columns of the memory cell array so as todetermine the values on the respective neurons, wherein the firstpattern is a defect pattern, wherein the defect pattern maps at leastone defective memory cell in the memory cell array, wherein the secondpattern comprises a plurality of weight pattern sensitivity values,wherein each of the plurality of weight pattern sensitivity values isdetermined by comparing at least one predetermined threshold value withone of the following in a corresponding column in the third pattern: anumber of logical “1” values, and a second number of logical “0” values,and wherein the third pattern is a weight pattern comprising a pluralityof weights, wherein each of the plurality of weights has a value of “0”or “1”.
 19. The system of claim 18, wherein the input data comprises oneof the following: the third pattern and output data of second neurons ofa second layer, wherein the second neurons of the second layer arecoupled to the first neurons of the first layer.
 20. The system of claim18, wherein the third pattern is determined through an off-chip trainingprocess.